home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-07-26 | 712 b | 29 lines | [TEXT/gamI] |
- ; Window port demo
-
- ; (query prompt) pops up a window, displays the prompt and returns the
- ; expression typed in the window. Note that a window is both an input and
- ; output port.
-
- (define (query prompt)
- (let ((p (open-text-window "Query")))
- (display prompt p)
- (let ((x (read p)))
- (close-output-port p)
- x)))
-
- ; (pretty obj) pops up a window with the pretty printed representation
- ; of 'obj'. Note that the result of 'pretty' is a port. You should close
- ; this port to get rid of the window.
-
- (define (pretty obj)
- (let ((p (open-text-window "Pretty")))
- (pp obj p)
- p))
-
-
- (define n (query "Enter a number: "))
-
- (let ((p (pretty query)))
- (mac#delay 300)
- (close-output-port p))
-